#pragma once
#include <sys/epoll.h>
#include <memory>
#include "Conn.h"

//网络线程类
class SocketWorker {
private:
	//epoll描述符
	int epollFd;
public:
	void AddEvent(int fd);
	void RemoveEvent(int fd);
	void ModifyEvent(int fd, bool epollOut);
private:
	void OnEvent(epoll_event ev);
	void OnAccept(std::shared_ptr<Conn> conn);
	void OnRW(std::shared_ptr<Conn> conn, bool r, bool w);
public:
	void Init();	//初始化
	void operator()();	//线程函数
};
